/*package com.hy.mydesktop.client.mvc.grid;

import java.util.Map;

import com.extjs.gxt.ui.client.mvc.AppEvent;
import com.extjs.gxt.ui.client.mvc.Dispatcher;
import com.extjs.gxt.ui.client.widget.Component;
import com.test.client.component.event.AppEvents;
import com.test.client.component.mvc.event.EventStructureMetaModel;
import com.test.client.mvc.base.BaseController;
import com.test.client.mvc.util.ControllerUtil;

public class GridController extends BaseController {
	private GridView gridView;

	public GridController() {
		
	}

	@Override
	public void handleEvent(AppEvent event) {
		Map<String, Object> map = (Map<String, Object>) event.getData();
		EventStructureMetaModel eventStructureMetaModel = (EventStructureMetaModel) map
				.get("eventstructuremetamodel");
		// EventStructureMetaModel eventStructureMetaModel
		// =(EventStructureMetaModel)((Map<String,
		// Object>)event.getData()).get("eventstructuremetamodel");
		// 0007
		if (AppEvents.DESKTOP_APPLICATION_INIT == event.getType()) {
			//if (eventStructureMetaModel==null||this.getId()==null||eventStructureMetaModel.getControllerId()==null||eventStructureMetaModel.getControllerId().equals(this.getId())) {
			if (ControllerUtil.isHandle(eventStructureMetaModel, this)) {
	
			// 转发到视图View
				forwardToView(gridView, event);
				*//**
				 * 获取Controller对应的View的组件Component 把Component，作为事件的一部分，向下传递
				 * map.put("parent", windowView.getWindow()); 此方法错误
				 *//*
				Map<BaseController, Component> subMap = (Map<BaseController, Component>) map
						.get("controllerandcomponent");
				;
				subMap.put(this, gridView.getGrid());
				*//**
				 * 把Controller和,与之对应的Component放入Map（为了方便查找Component的父元素）
				 *//*
				map.put("controllerandcomponent", subMap);
				*//**
				 * 如何知道事件已经转发完毕
				 * 
				 * 方法1 ： 计数器
				 *//*

				if (this.getChildren() != null && this.getChildren().size() > 0) {
					*//**
					 * 将事件转发给子节点，及子控制器 注:当前控制器，含有子节点的时候，必不可少
					 * 
					 * 采用先序遍历的方式---树
					 *//*
					this.forwardToChild(new AppEvent(
							AppEvents.DESKTOP_APPLICATION_INIT, map));
				} 
				 * else {
				 
				*//**
				 * 如果当前控制器，有子节点，则向下转发事件， 否则渲染组件，即渲染顶级元素 如何渲染顶级元素，即Window ？
				 *//*
				
				 * forwardToView(windowView,
				 * AppEvents.DESKTOP_APPLICATION_RENDER,event.getData()); }
				 
				int count = ((Integer) map.get("count") - 1);
				if (count <= 0) {
					Dispatcher.forwardEvent(
							AppEvents.DESKTOP_APPLICATION_RENDER, map);
				} else {
					map.put("count", count);
				}
				ControllerUtil.isRenderer(map);

			}
		}
		
		//0008
		else if (AppEvents.LOAD_DATA_EVENT==event.getType()) {
			//if (eventStructureMetaModel==null||eventStructureMetaModel.getControllerId()==null||eventStructureMetaModel.getControllerId()==this.getId()) {
				System.out.println("GridController------------AppEvents.LOAD_DATA_EVENT");	

					*//**
					 * 如果当前控制器，有子节点，则向下转发事件，
					 * 否则渲染组件，即渲染顶级元素
					 * 如何渲染顶级元素，即Window ？
					 * forwardToView(View view, AppEvent event)
					 *//*
					forwardToView(gridView, event);
			//}		
		}else {
			this.forwardToChild(event);
		};
	}

	public void initialize() {
		gridView = new GridView(this);
	}

	protected void onError(AppEvent ae) {
		System.out.println("error: " + ae.<Object> getData());
	}
}*/
